package cn.itcast.export.service.impl;

import cn.itcast.export.dao.ExportDao;
import cn.itcast.export.dao.ExportProductDao;
import cn.itcast.export.domain.Export;
import cn.itcast.export.domain.ExportExample;
import cn.itcast.export.domain.ExportProduct;
import cn.itcast.export.service.ExportService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

@Service
public class ExportServiceImpl implements ExportService {

	@Autowired
	private ExportDao exportDao;

	@Autowired
	private ExportProductDao exportProductDao;

	public void save(Export export) {
		export.setEid(UUID.randomUUID().toString());
		exportDao.insertSelective(export);
	}

	public Export findById(String id) {
		return exportDao.selectByPrimaryKey(id);
	}

	public void update(Export export) {
		exportDao.updateByPrimaryKeySelective(export);
	}

	public void delete(String id) {
		exportDao.deleteByPrimaryKey(id);
	}

	public List findAll(ExportExample exportExample) {
		return exportDao.selectByExample(exportExample);
	}

	@Override
	public Export findByExportId(String id) {
		return exportDao.findByExportId(id);
	}
}
